﻿@namespace SwashbucklerDiary.Components
@inherits DialogComponentBase

<MultiDisplay>
    <MobileContent>
        <MBottomSheetExtension MyValue="Value"
                               MyValueChanged="ValueChanged"
                               ContentClass="rounded-t-lg"
                               Eager="true">
            <MCard Class="rounded-t-lg py-2">
                <MList>
                    @foreach (var item in DynamicListItems)
                    {
                        @if (item.Show)
                        {
                            <MListItem OnClick="()=>OnClick(item.OnClick)">
                                <MListItemIcon>
                                    <MIcon>
                                        @(item.Icon)
                                    </MIcon>
                                </MListItemIcon>
                                <MListItemContent>
                                    @(I18n.T(item.Text))
                                </MListItemContent>
                            </MListItem>
                            if (DynamicListItems.Last(it => it.Show) != item)
                            {
                                <MDivider></MDivider>
                            }
                        }
                    }
                    <MListItem>
                        <MButton Rounded="true"
                                 Block="true"
                                 Depressed="true"
                                 Large="true"
                                 Class="text-subtitle-1"
                                 OnClick="HandleOnCancel">
                            @(I18n.T("Share.Cancel"))
                        </MButton>
                    </MListItem>
                </MList>
            </MCard>
        </MBottomSheetExtension>
    </MobileContent>
    <DesktopContent>
        <MDialogExtension MyValue="Value"
                          MyValueChanged="ValueChanged"
                          ContentClass="rounded-lg"
                          MaxWidth="420"
                          Eager="true">
            <MCard>
                <MCardTitle Class="font-weight-bold">
                    @Title
                    <MSpacer></MSpacer>
                    <MButton Icon="true"
                             OnClick="HandleOnCancel">
                        <MIcon>mdi-close</MIcon>
                    </MButton>
                </MCardTitle>
                <MCardText>
                    @foreach (var item in DynamicListItems)
                    {
                        @if (item.Show)
                        {
                            <MListItem Class="px-0"
                                       OnClick="()=>OnClick(item.OnClick)">
                                <MListItemIcon Class="my-3">
                                    <MIcon Class="list-item-icon">
                                        @(item.Icon)
                                    </MIcon>
                                </MListItemIcon>
                                <MListItemContent>
                                    <MListItemTitle>
                                        @(I18n.T(item.Text))
                                    </MListItemTitle>
                                </MListItemContent>
                            </MListItem>
                        }
                    }
                </MCardText>
            </MCard>
        </MDialogExtension>
    </DesktopContent>
</MultiDisplay>
